<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{:C('WEB_SITE_TITLE')}【后台】</title>
    <link href="__INSPINIA__/css/bootstrap.min.css" rel="stylesheet">
    <link href="__INSPINIA__/font-awesome/css/font-awesome.css" rel="stylesheet">
    <link href="__INSPINIA__/css/animate.css" rel="stylesheet">
    <link href="__INSPINIA__/css/style.css" rel="stylesheet">
	<!-- Toastr style -->
	<link href="__INSPINIA__/css/plugins/toastr/toastr.min.css" rel="stylesheet">
</head>
<body class="gray-bg">
    <div class="loginColumns animated fadeInDown">
        <div class="row">

            <div class="col-md-6">
                <h1 class="font-bold">欢迎使用{:C('WEB_SITE_TITLE')}后台</h1>
                {:C('WEB_SITE_DESCRIPTION')}
            </div>
            <div class="col-md-6">
                <div class="ibox-content">
		            <form class="m-t" action="{:U('login')}" method="post" >
		                <div class="form-group">
		                    <input required="" type="text" id="username" name="username" class="form-control" placeholder="请填写用户名" >
		                </div>
		                <div class="form-group">
		                    <input required="" type="password" id="password" name="password"  class="form-control" placeholder="请填写密码">
		                </div>
		                <div class="form-group">
		                    <input  required="" type="text" id="verify" name="verify" class="form-control" placeholder="请填写验证码" autocomplete="off">
		                </div> 
		                <div class="form-group">
		                    <img class="verifyimg reloadverify full-width" alt="点击切换" src="{:U('Public/verify')}" style="cursor:pointer;">
		                </div> 
		                <button type="submit" class="btn btn-primary block full-width m-b">登陆</button>
					</form> 
                </div>
            </div>
        </div>
        <hr/>
        <div class="row">
            <div class="col-md-6">
                <strong>版权所有</strong>  {:C('COMPANY_CONFIG_NAME')} 
            </div>
            <div class="col-md-6 text-right">
               <small>{:C('WEB_SITE_ICP')}&copy;2015</small>
            </div>
        </div>
    </div>
    <!-- Mainly scripts -->
    <script src="__INSPINIA__/js/jquery-2.1.1.js"></script>
    <script src="__INSPINIA__/js/bootstrap.min.js"></script>
    <!-- Toastr -->
    <script src="__INSPINIA__/js/plugins/toastr/toastr.min.js"></script>
	<script type="text/javascript">
    	$(document)
	    	.ajaxStart(function(){
	    		$("button:submit").addClass("log-in").attr("disabled", true);
	    	})
	    	.ajaxStop(function(){
	    		$("button:submit").removeClass("log-in").attr("disabled", false);
	    	});
    	$("form").submit(function(){
    		var self = $(this);
    		$.post(self.attr("action"), self.serialize(), success, "json");
    		return false;

    		function success(data){
    			if(data.status){
    				window.location.href = data.url;
    			} else {
   		           setTimeout(function() {
   		               toastr.options = {
   		                   closeButton: true,
   		                   progressBar: true,
   		                   showMethod: 'slideDown',
   		                   timeOut: 1000
   		               };
   		               toastr.error(data.info, '出错了');
   		           }, 1300);
    				//刷新验证码
    				$(".reloadverify").click();
    			}
    		}
    	});

		$(function(){
			var verifyimg = $(".verifyimg").attr("src");
            $(".reloadverify").click(function(){
                if( verifyimg.indexOf('?')>0){
                    $(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
                }else{
                    $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
                }
            });
		});
	</script>
</body>

</html>
 